package cn.source.system.account.exception;

/**
 * 异常编码  0成功、-1熔断、 -2 标准参数校验不通过 、-3 会话超时
 * 前两位:服务标识
 * 中间两位:模块标识
 * 后两位:异常标识
 */

/**
 * <p>ErrorCode.java此类用于异常信息展示</p>
 * <p>@author:YXZhou</p>
 * <p>@remark:</p>
 */
public enum ErrorCode {

    ////////////////////////////////////公用异常编码 //////////////////////////
    // TODO 公用异常编码
    E_100102(100102, "验证码错误"),
    E_100103(100103, "验证码为空"),
    E_100104(100104, "验证码超过当天获取次数"),
    E_100105(100105, "验证码失效"),
    E_100106(100106, "excel导出异常"),
    E_100107(100107, "没有权限，无法系统登陆"),
    E_100108(100108, "手机号码未注册"),
    E_100109(100109, "手机号码格式不正确"),
    E_100110(100110, "账号异常"),
    E_100111(100111, "获取Token失败"),
    E_100112(100112, "账号未注册"),

    ////////////////////////////////////统一用户微服务//////////////////////////
    E_110101(110101, "创建账号错误"),
    E_110102(110102, "用户服务出错"),
    E_110103(110103, "资源服务出错"),
    E_110104(110104, "授权服务出错"),
    E_110106(110106, "账号绑定租户出错"),
    E_110107(110107, "账号解绑租户出错"),
    E_110108(110108, "获取账号列表失败"),
    E_110109(110109, "账号与角色解绑失败"),

    ////////////////////////////////////用户管理异常编码 //////////////////////////
    E_120101(120101, "账号为空"),
    E_120102(120102, "密码为空"),
    E_120103(120103, "手机号码为空"),
    E_120104(120104, "用户名或密码错误"),

    E_130113(130113, "旧密码为空"),
    E_130114(130114, "新密码为空"),
    E_130115(130115, "账号已存在"),
    E_130116(130116, "密码错误"),
    E_130117(130117, "新旧密码相同"),
    E_130118(130118, "密码修改失败"),
    E_130119(130119, "请先解绑租户类型下角色，再操作"),
    E_130120(130120, "请先解绑租户下角色，再操作"),
    E_130121(130121, "请先解绑租户下账号，再操作"),
    E_130122(130122, "租户类型下有实体租户，操作失败"),
    E_130124(130124, "删除失败，请先解除绑定关系"),
    E_130127(130127, "账号绑定租户出错"),
    E_130130(130130, "创建租户出错"),
    E_130134(130134, "角色不能为空 "),
    E_130135(130135, "姓名不能为空 "),
    E_130137(130137, "手机号码格式不正确"),
    E_130138(130138, "小区不能为空"),
    E_130139(130139, "授权失败，请稍后重试"),
    E_130140(130140, "账号不能为空"),
    E_130141(130141, "密码不能为空"),
    E_130142(130142, "账号或密码错误"),
    E_130143(130143, "该账号未关联智慧社区"),
    E_130144(130144, "登陆异常"),
    E_130145(130145, "无操作权限"),
    E_130146(130146, "非智慧社区账号，无操作权限"),


    E_140301(140301, "暂未授权"),
    E_140302(140302, "用户名为空"),
    ///////部门管理异常编码////////
    E_140401(140401, "部门名称为空"),
    E_140402(140402, "部门领导为空"),
    E_140403(140403, " 已关联下级部门，无法删除"),
    E_140404(140404, " 已关联人员，无法删除"),
    ///////岗位管理异常编码////////
    E_140501(140501, "岗位名称为空"),
    E_140502(140502, "岗位排序为空"),

    E_150421(150421, "重复数据"),
    E_150423(150423, "手机号码格式不正确"),
    E_400110(400110, "验证码失效"),

    E_180305(180305, "模版错误，无法解析"),
    E_180311(180311, "已关联缴费信息，无法删除"),
    E_180312(180312, "模版中数据无法解析"),


    ////////////////////////////////////特殊异常编码/////////////////////////////////////
    // TODO 其他异常
    CUSTOM(999998, "自定义异常"),
    UNKOWN(999999, "未知错误");


    private int code;
    private String desc;

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    private ErrorCode(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
